<template>
  <div>
    <Navbar :appTitle="appTitle" />
    <div class="form-content wrap-apply" :style="{
      top: GLOBAL.currentEnvironment ? '0' : '',
      height: GLOBAL.currentEnvironment ? '100vh' : 'calc(100vh - 100px)',
      paddingBottom: GLOBAL.currentEnvironment ? '120px' : '',
    }">
      <van-cell-group class="formItemFlex">
        <p class="label required FormTit"><span></span>入库单编号</p>
        <div class="haveUnitBox">
          <van-field v-model="buildForm.taskCode" :maxLength="50" placeholder="请输入、不输入则自动生成" input-align="right" />
        </div>
      </van-cell-group>
      <div class="bottomLine"></div>
      <van-cell-group class="formItemFlex">
        <p class="label FormTit"><span></span>单据日期</p>
        <div class="haveUnitBox">
          <van-field input-align="right" is-link readonly name="picker" v-model="buildForm.operateTime"
            @click="openTimePicker(0, buildForm.operateTime, 'operateTime')" placeholder="请选择" />
        </div>
        <div class="bottomLine"></div>
      </van-cell-group>
      <div class="bottomLine"></div>
      <van-cell-group class="formItemFlex">
        <p class="label required FormTit"><span></span>业务类型</p>
        <van-field-select-picker :supportClear="true" label="" placeholder="请选择" v-model="buildForm.operateTaskType"
          :columns="warehousingTypes" :option="{ label: 'text', value: 'value' }" />
        <div class="bottomLine"></div>
      </van-cell-group>

      <div>
        <div class="addGoodScontain">
          <div class="addgoods" @click="addInventoryGoods">
            <van-icon name="plus" size="16px" color="#1890ff" style="top: 2px" />
            <a>物品</a>
          </div>
        </div>
      </div>

      <div class="tabs-contain" v-if="entryDetails && entryDetails.length != 0">
        <van-tabs v-model:active="active" color="#1989fa" line-height="0.01rem" line-width="3.5rem"
          title-active-color="#108ee9" swipe-threshold="3">
          <van-tab v-for="(item, index) in entryDetails" title-class="tab-wrap-ano" :key="item.goodsKey"
            :title="item.goodsName" :name="item.goodsKey">
            <div class="list">
              <div class="wrap">
                <div class="top">
                  <div class="title titleWidth">
                    {{ item.goodsCode }} | {{ item.goodsName }} | {{ item.spec }}
                  </div>
                </div>
                <div class="center">
                  <div>
                    <p>
                      <span class="key">包装规格：</span>
                      <span class="value">{{ item.packageSpec }}</span>
                    </p>
                    <p>
                      <span class="key">产地：</span>
                      <span class="value">{{ item.address }}</span>
                    </p>
                    <p>
                      <span class="key">单位：</span>
                      <span class="value">{{ item.unitName }}</span>
                    </p>
                  </div>
                </div>
                <van-cell-group class="formItemFlex">
                  <p class="label required FormTit"><span></span>批号</p>
                  <div class="haveUnitBox">
                    <van-field v-model="item.batchCode" :maxLength="50" placeholder="请输入" input-align="right"
                      @input="batchCodeChange(index, item)" />
                  </div>
                </van-cell-group>
                <div class="bottomLine"></div>
                <van-cell-group class="formItemFlex">
                  <p class="label required FormTit"><span></span>生产日期</p>
                  <div class="haveUnitBox">
                    <van-field input-align="right" is-link readonly name="picker" v-model="item.produceDate"
                      @click="openTimePicker(index, item.produceDate, 'produceDate')" placeholder="请选择" />
                  </div>
                </van-cell-group>
                <div style="height: 6px; background-color: #f3f3f3; width: 100%;"></div>

                <div class="list">
                  <div class="wrap" v-for="(p, i) in item.inLatticeDtoList" :key="p.latticeId"
                    v-show="item.inLatticeDtoList.length != 0">
                    <van-cell-group>
                      <p class="label otherText">
                        <span>库位（{{ i + 1 }}）</span>
                        <span class="deleteStyle" @click="deleteLattice(i)">删除</span>
                      </p>
                      <div class="bottomLine"></div>
                      <van-cell-group class="formItemFlex">
                        <p class="label required FormTit" style="min-width: 0"><span></span>入库库位</p>
                        <div class="haveUnitBox">
                          <van-field style="width: 7.1rem" v-model="p.latticeInfo" placeholder="请选择或扫码"
                            input-align="right" readOnly @click="showLatticeNotification(index, i)">
                            <template #right-icon>
                              <div style="display: flex;">
                                <van-icon @click="showLatticeNotification(index, i)" size="20" color="#999" name="arrow"
                                  style="margin-top: 2px" />
                                <van-icon @click.stop="clickCode(index, i)" size="20" color="#999" name="scan"
                                  style="margin-top: 2px" />
                              </div>
                            </template>
                          </van-field>
                        </div>
                      </van-cell-group>
                      <div class="bottomLine"></div>
                      <van-cell-group class="formItemFlex">
                        <p class="label required FormTit"><span></span>入库数量</p>
                        <div class="haveUnitBox">
                          <van-field v-model="p.goodsNum" type="number" placeholder="请输入" input-align="right"
                            :formatter="(e) => clearNoNum(e)">
                            <template #right-icon>
                              <span>{{ item.unitName || '' }}</span>
                            </template>
                          </van-field>
                        </div>
                      </van-cell-group>
                    </van-cell-group>
                    <div style="height: 6px; background-color: #f3f3f3; width: 100%;"></div>
                  </div>
                  <div class="addGoodScontain">
                    <div class="addgoods" style="border-right: 1px solid #f2f2f2;"
                      @click="showLatticeNotification(index)">
                      <van-icon name="plus" size="16px" color="#1890ff" style="top: 2px" />
                      <a>库位</a>
                    </div>
                    <div class="addgoods" @click="clickCode(index, null, true)">
                      <van-icon name="scan" size="16px" color="#1890ff" style="top: 2px" />
                      <a>扫库位码</a>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </van-tab>
        </van-tabs>
        <div class="all-down-btn" v-show="entryDetails.length > 3">
          <p @click="openDropDownModel">
            <span>全部</span>
            <span>
              <van-icon name="arrow-down" color="#1989fa" size="16" />
            </span>
          </p>
        </div>
        <div class="all-down-model" v-show="allDownShow">
          <div class="tags-contain">
            <span class="goodsNameTag" v-for="(item, index) in entryDetails" @click="clickGoodsNames(item)"
              :style="{ color: item.goodsKey == active ? '#1890ff' : '#333333' }">
              {{ item.goodsName }}
            </span>
          </div>
          <div class="ctrBtn-contian">
            <span @click="closeDropDownModel">收起</span>
            <span>
              <van-icon name="arrow-up" color="#1989fa" size="16" />
            </span>
          </div>
        </div>
      </div>
      <van-empty v-else description="物品明细为空" />

      <div class="search-bottoms">
        <van-button class="btncancle" :loading="subLoading" loading-text="提交中..."
          @click="btnConfirm(true)">提交并打印</van-button>
        <van-button class="btnconfirm" :loading="subLoading" loading-text="提交中..."
          @click="btnConfirm(false)">提交</van-button>
      </div>
    </div>
    <!--选择物品 -->
    <goods-pickers-ak v-if="showGoodsPicker" :listUrl="listUrl" :columns="goodsColumns" :selectedGoods="[]"
      @getCheckedGoods="getCheckedGoods"></goods-pickers-ak>
    <!--选择生产日期 -->
    <van-popup v-model="timePickShow" position="bottom">
      <van-datetime-picker @confirm="confirmPick" v-model="happenTime" @cancel="cancelPick" type="date" title="入库时间"
        :formatter="formatter" />
    </van-popup>
    <!--选择库位 -->
    <binLocation-pickers-ak v-if="isShowLatticeNotification" :listUrl="latticeNotificationUrl"
      :columns="latticeNotificationgColumns" :checkedShow="recentLatIndex == -1 ? true : false"
      :selectedGoods="recentLatIndex == -1 ? entryDetails[recentGoodsIndex]['inLatticeDtoList'] : []"
      @getCheckedValue="getCheckedValue" @handleList="handleList"></binLocation-pickers-ak>
    <!-- 浏览器扫码组件 -->
    <qrcode :qrcode="codeForm.qrcode" :showClose="codeForm.showClose" v-show="codeForm.qrcode" :camera="camera"
      :torchActive="torchActive" @switchCamera="switchCamera" @ClickFlash="ClickFlash" @turnCameraOff="turnCameraOff"
      @onDecode="onDecode" @onInit="onInit" />
    <!-- 激光扫码组件 -->
    <PDAsao @changeScan="changeScan2" />
    <!-- 批量扫码弹窗 -->
    <van-popup v-model="isshow" :overlay="false" position="bottom" :style="{ height: '50%' }"
      :close-on-click-overlay="false" v-if="entryDetails.length != 0 && qrlatticeNotification.length != 0">
      <div class="qrcodeModel">
        <div class="nav_contain">
          <span class="left" @click="modelClose">
            <van-icon :size="20" color="#3ba1ff" name="arrow-left" />
          </span>
          <span class="center">
            入库库位
          </span>
          <span class="right" @click="modelCofirm">
            确定
          </span>
        </div>
        <div class="goodsInfo">
          <div class="wrap">
            <div class="top">
              <div class="title titleWidth">
                {{ entryDetails[recentGoodsIndex].goodsCode }} |
                {{ entryDetails[recentGoodsIndex].goodsName }} |
                {{ entryDetails[recentGoodsIndex].spec }}
              </div>
            </div>
            <div class="center">
              <div>
                <p>
                  <span class="key">产地：</span>
                  <span class="value">{{ entryDetails[recentGoodsIndex].address }}</span>
                </p>
                <p>
                  <span class="key">包装规格：</span>
                  <span class="value">{{ entryDetails[recentGoodsIndex].packageSpec }}</span>
                </p>
                <p>
                  <van-tag color="#e8f4ff" text-color="#1890ff">{{ entryDetails[recentGoodsIndex].produceDate
                    }}</van-tag>
                  <van-tag color="#e8f4ff" text-color="#1890ff">{{ entryDetails[recentGoodsIndex].batchCode }}</van-tag>
                  <van-tag style="width: 42px;" color="#e8f4ff" text-color="#1890ff">{{
                    entryDetails[recentGoodsIndex].unitName }}</van-tag>
                </p>
              </div>
              <div class="totalContain" :style="{ 'width': qrlatticeNotificationTotal.length > 6 ? '145px' : '105px' }">
                <p style="height: 24px;"></p>
                <p>已选{{ qrlatticeNotification.length || 0 }}</p>
                <p class="totalValue">入库合计{{ qrlatticeNotificationTotal || 0 }}</p>
              </div>
            </div>
          </div>
        </div>
        <div class="list">
          <div class="wrap" v-for="(p, i) in qrlatticeNotification" :key="p.latticeId">
            <van-cell-group>
              <p class="label otherText">
                <span style="border-left: 4px solid #40a9ff;">
                  {{ p.latticeInfo }}
                </span>
                <span class="deleteStyle" :style="{ 'color': '#ff4d4f' }" @click="deleteLatticeInmodel(i)">删除</span>
              </p>
              <div class="bottomLine"></div>
              <van-cell-group class="formItemFlex">
                <p class="label FormTit">入库数量</p>
                <div class="haveUnitBox">
                  <van-field v-model="p.goodsNum" type="number" placeholder="请输入" input-align="right"
                    :formatter="(e) => clearNoNum(e, p.goodsNum)">
                    <template #right-icon>
                      <span>{{ entryDetails[recentGoodsIndex].unitName || '' }}</span>
                    </template>
                  </van-field>
                </div>
              </van-cell-group>
            </van-cell-group>
            <div style="height: 6px; background-color: #f3f3f3; width: 100%;"></div>
          </div>
        </div>
      </div>
    </van-popup>
  </div>
</template>
<script>
import moment from "moment";
import Navbar from "@/components/navBar/navBar_right";
import VanFieldSelectPicker from "@/components/ActionSheet/VanFieldSelectPicker";
import GoodsPickersAk from "@/components/choiceuse/GoodsPickersAk";
import {
  genEntityCode,
  getDictItemsByTypes,
  addInWarehousing,
  editInWareHousing,
  getBathRelProductDate,
  queryBasicInfoById,
  queryInGoodsInfoPage,
  getWarehouseLatticeDetail,
  queryDefaultLattice
} from "@/api/inventoryOrder";
import store from "@/store";
import BinLocationPickersAk from "@/components/choiceuse/BinLocationPickersAk";
import PDAsao from "@/components/scanCode/PDAsao.vue";
import { Dialog } from "vant";
import Decimal from 'decimal.js';

export default {
  name: "warehouseWarrantForm",
  components: {
    Navbar,
    VanFieldSelectPicker,
    GoodsPickersAk,
    BinLocationPickersAk,
    qrcode: () => import("@/components/scanCode"),
    PDAsao
  },
  data() {
    return {
      appTitle: "新建入库单",
      buildForm: {
        taskCode: "",
        operateTime: "",
        operateTaskType: "OTHER",
        operateType: "1"
      },
      showGoodsPicker: false,
      listUrl: "/baseSetting/wmsGoods/queryByPage",
      goodsColumns: {
        titleKey: ['goodsCode', 'goodsName', 'spec'], //标题
        content: [
          //内容
          {
            name: "产地",
            key: ["address"],
          },
          {
            name: "包装规格",
            key: ["packageSpec"],
          },
          {
            name: "单位",
            key: ["unitIdText"],
          },
        ],
        operationText: "",
      },
      entryDetails: [],
      recentGoodsIndex: 0,
      warehousingTypes: [],
      timePickShow: false,
      happenTime: '',
      timeUsedKey: 'operateTime',
      isEdit: false,
      active: '',
      allDownShow: false,
      recentLatIndex: 0,
      isShowLatticeNotification: false,
      latticeNotificationUrl: "/wmslattice/getLatticeNotification",
      latticeNotificationgColumns: {
        titleKey: ["latticeCode", "latticeName"], //标题
        content: [
          //内容
          {
            name: "库位物品",
            key: ["goodsNameTxt"],
          },
          {
            name: "物品数量",
            key: ["goodsNumTxt"],
          },
          {
            name: "物品总数量",
            key: ["totalNum"],
          },
          { // 多选时调用
            name: "入库数量",
            key: ["goodsNum"],
            type: 'input',
            unit: 'unitName'
          },
        ],
        labelKey: [], //标签
        operationText: "",
        usedBy: "warehouseWarrantForm",
      },
      isToPrint: false,
      // 扫码相关
      codeForm: {
        qrcode: false,
        showClose: false,
      },
      torchActive: true,
      camera: "off",
      recentLatIndex: -1,
      isshow: false,
      qrlatticeNotification: [],
      subLoading: false
    };
  },
  beforeRouteLeave(to, from, next) {
    if (this.showGoodsPicker || this.isShowLatticeNotification) {
      this.showGoodsPicker = false;
      this.isShowLatticeNotification = false;

      if (this.isEdit) {
        this.appTitle = '编辑入库单';
      } else {
        this.appTitle = '新建入库单';
      }
      next(false);
    } else {
      next();
    }
  },
  async created() {
    store.commit("SET_CURRENT_PREFIX", "/jksaas-produce/produce");
    this.initData();
  },
  computed: {
    qrlatticeNotificationTotal() {
      // 确保 qrlatticeNotification 是数组类型，并且数组不为空
      if (!Array.isArray(this.qrlatticeNotification) || this.qrlatticeNotification.length === 0) {
        return 0; // 如果不满足条件，直接返回 0
      }

      // 使用数组的 reduce 方法来累加 goodsNum，如果 goodsNum 不存在则默认为 0
      return this.qrlatticeNotification.reduce((accumulator, currentNotification) => {
        // 确保 currentNotification.goodsNum 存在且为数字类型
        const goodsNum = typeof currentNotification.goodsNum === 'number' ? currentNotification.goodsNum : this.formatGoodsNum(currentNotification);
        return new Decimal(goodsNum).plus(accumulator).toString();
      }, 0);
    },
  },
  methods: {
    formatGoodsNum(currentNotification) {
      const rawGoodsNum = typeof currentNotification.goodsNum === 'number'
        ? currentNotification.goodsNum
        : Number(currentNotification.goodsNum);

      // Check if the number has more than 16 total digits, including four decimal places
      const numLength = rawGoodsNum.toString().length;
      const decimalPlaces = rawGoodsNum.toString().split('.')[1]?.length || 0;

      if (numLength - decimalPlaces <= 16) {
        return rawGoodsNum;
      }

      // Round up the number to four decimal places
      const roundedGoodsNum = Math.ceil(rawGoodsNum * 10000) / 10000;

      return roundedGoodsNum.toFixed(4);
    },
    // 确认选中库位 多选
    async getCheckedValue(list) {
      if (this.recentLatIndex != -1) {
        return
      }
      this.isShowLatticeNotification = false;
      this.appTitle = this.isEdit ? "编辑入库单" : "新建入库单";

      this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'] = list.map((son) => {
        let recIndex = this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'].findIndex((ele) => ele.latticeId == son.id)

        if (recIndex != -1) {
          let recObj = this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'][recIndex]
          recObj['goodsNum'] = son['goodsNum']
          return recObj
        } else {
          let { id, latticeCode, latticeName, goodsNum } = son
          return {
            latticeId: id,
            latticeCode: latticeCode,
            latticeName: latticeName,
            latticeInfo: latticeCode + '|' + latticeName,
            goodsNum: goodsNum || ''
          };
        }
      });
    },
    // 确认选中库位 单选
    handleList(binLocationid, item, text) {
      if (this.recentLatIndex == -1) {
        return
      }
      this.isShowLatticeNotification = false;
      this.appTitle = this.isEdit ? "编辑入库单" : "新建入库单";

      let isValidated = true;
      try {
        this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'].forEach((ele) => {
          if (ele.latticeId == item.id) {
            this.isValidated = false
            throw new Error(`该库位已存在`);
          }
        })
        if (!isValidated) {
          return;
        }
      } catch (error) {
        this.$toast(error.message);
        return false;
      }

      let { id, latticeCode, latticeName } = item
      this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'][this.recentLatIndex] = {
        latticeId: id,
        latticeCode: latticeCode,
        latticeName: latticeName,
        latticeInfo: latticeCode + '|' + latticeName,
        goodsNum: ''
      }
    },
    // 库位选择
    showLatticeNotification(index, rclIndex) {
      this.recentGoodsIndex = index
      if (rclIndex != undefined) {
        this.recentLatIndex = rclIndex
        this.latticeNotificationgColumns.content = [
          {
            name: "库位物品",
            key: ["goodsNameTxt"],
          },
          {
            name: "物品数量",
            key: ["goodsNumTxt"],
          },
          {
            name: "物品总数量",
            key: ["totalNum"],
          },
        ]
      } else {
        this.recentLatIndex = -1
        this.latticeNotificationgColumns.content = [
          {
            name: "库位物品",
            key: ["goodsNameTxt"],
          },
          {
            name: "物品数量",
            key: ["goodsNumTxt"],
          },
          {
            name: "物品总数量",
            key: ["totalNum"],
          },
          { // 多选时调用
            name: "入库数量",
            key: ["goodsNum"],
            type: 'input',
            unit: 'unitName'
          },
        ]
      }
      this.appTitle = '库位';
      this.isShowLatticeNotification = true
    },
    // 删除库位
    deleteLattice(index) {
      let recIndex = this.entryDetails.findIndex((ele) => ele.goodsKey == this.active)

      this.recentGoodsIndex = recIndex
      let inLatticeDtoListLength = this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'].length

      // 物品关联库位为1时 删除当前物品
      if (inLatticeDtoListLength == 1) {
        Dialog.confirm({
          title: `确定删除物品${this.entryDetails[this.recentGoodsIndex]['goodsName']}`,
          message: '',
          confirmButtonColor: '#2b85e4'
        }).then(() => {
          if (recIndex != -1) {
            this.entryDetails.splice(this.recentGoodsIndex, 1);
            this.recentGoodsIndex = 0
          }
        }).catch(() => { })
      } else {
        if (recIndex != -1) {
          this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'].splice(index, 1);
        }
      }
    },
    // tag 弹出层相关功能
    openDropDownModel() {
      this.allDownShow = true
    },
    closeDropDownModel() {
      this.allDownShow = false
    },
    clickGoodsNames(item) {
      this.active = item.goodsKey
      this.allDownShow = false
    },

    // 重置form表单
    resetForm() {
      this.buildForm = {
        taskCode: "",
        operateTime: "",
        operateTaskType: "OTHER",
        operateType: "1"
      }

      this.entryDetails = []
      this.recentGoodsIndex = 0
      this.warehousingTypes = []
      this.happenTime = ''
      this.active = ''
      this.recentLatIndex = 0
    },
    // 提交
    btnConfirm(isToPrint) {
      this.isToPrint = isToPrint
      if (!this.buildForm.taskCode) {
        this.$toast(`请输入入库单编号`);
        return;
      }

      if (!this.buildForm.operateTime) {
        this.$toast(`请输入单据日期`);
        return;
      }

      if (!this.buildForm.operateTaskType) {
        this.$toast(`请选择业务类型`);
        return;
      }

      let isValidated = true;
      try {
        // 入库物品明细 为空 选项名称、数量 表单验证
        if (this.entryDetails && this.entryDetails.length > 0) {
          this.entryDetails.forEach((element, index) => {
            if (element.goodsId) {
              if (!element.batchCode || element.batchCode == "") {
                isValidated = false;
                throw new Error(`物品明细（${index + 1}）批号不可为空`);
              }
              if (!element.produceDate || element.produceDate == "") {
                isValidated = false;
                throw new Error(`物品明细（${index + 1}）生产日期不可为空`);
              }
              if (element.inLatticeDtoList && element.inLatticeDtoList.length > 0) {
                element.inLatticeDtoList.forEach((ele, i) => {
                  if (!ele.latticeId || ele.latticeId == "") {
                    isValidated = false;
                    throw new Error(`物品（${element.goodsName}）库位（${i + 1}） 入库库位不可为空`);
                  }
                  if (!ele.goodsNum || ele.goodsNum == "" || ele.goodsNum == 0) {
                    isValidated = false;
                    throw new Error(`物品（${element.goodsName}）库位（${i + 1}） 入库数量不可为空且不为零`);
                  }
                })
              } else {
                isValidated = false;
                throw new Error(`物品（${element.goodsName}）库位不可为空`);
              }
            } else {
              isValidated = false;
              throw new Error(`请选择物品`);
            }
          });

          let duplicateindex = this.hasDuplicateObjects(this.entryDetails)
          if (duplicateindex != -1) {
            throw new Error(`物品（${this.entryDetails[duplicateindex]['goodsName']}）批号不可相同`);
          }
        } else {
          isValidated = false;
          throw new Error(`请选择物品`);
        }

        if (!isValidated) {
          return;
        }
      } catch (error) {
        this.$toast(error.message);
        return false;
      }
      this.handleSubmit();
    },
    handleSubmit() {
      let num = 0
      let params = {
        ...this.buildForm,
        inWmsGoodsList: this.entryDetails.map((ele, index) => {
          num += 1
          return {
            id: this.isEdit ? ele.id : '',
            batchCode: ele.batchCode,
            goodsBatchId: ele.goodsBatchId,
            goodsId: ele.goodsId,
            produceDate: ele.produceDate,
            inLatticeDtoList: ele.inLatticeDtoList.map((ele2, index2) => {
              num += index2
              return {
                ...ele2,
                sortNum: this.isEdit ? num : '',
              }
            })
          };
        }),
      };

      let commitApi = "";
      let successMeg = "";
      if (this.isEdit) {
        commitApi = editInWareHousing;
        successMeg = "入库单编辑成功";
      } else {
        commitApi = addInWarehousing;
        successMeg = "入库成功";
      }

      this.subLoading = true
      commitApi(params).then((res) => {
        if (res.success) {
          this.$toast(successMeg);
          if (this.isToPrint) {
            this.btnPrint(res.result)
          } else {
            this.initData()
          }
        } else {
          this.$toast(res.message);
        }
        this.subLoading = false
      }).catch(() => {
        this.subLoading = false
      }).finally(() => {
        this.subLoading = false
      })
    },
    // 初始化页面数据
    initData() {
      let id = this.$route.query.id;
      this.resetForm()
      // 获取当前用户 设定为提交人参数
      let currentLoginUser = JSON.parse(localStorage.getItem("pro__Login_Userinfo")).value;
      this.buildForm.applyUserId = currentLoginUser.id;
      // 单据日期 默认当天
      this.buildForm.operateTime = moment(new Date()).format("YYYY-MM-DD")
      // 获取入库单类型
      getDictItemsByTypes({ type: 3 }).then((res) => {
        if (res.code == 200 && res.result) {
          this.warehousingTypes = res.result
        }
      });

      if (id) {
        this.isEdit = true
        this.appTitle = "编辑入库单";
        // 入库单详情 基本信息
        queryBasicInfoById({ id: id }).then((res) => {
          if (res.code == 200 && res.result) {
            let { id, taskCode, operateTime, operateTaskType } = res.result;
            this.buildForm = {
              id: id || '',
              taskCode: taskCode || '',
              operateTime: operateTime || '',
              operateTaskType: operateTaskType || '',
              operateType: "1"
            }
          } else {
            this.$toast(res.message);
          }
        });
        // 入库单详情 物品明细
        queryInGoodsInfoPage({ id: id, pageSize: -1, pageNo: 1 }).then((res) => {
          if (res.code == 200 && res.result) {
            this.getCheckedGoods(res.result.records)
          } else {
            this.$toast(res.message);
          }
        });
      } else {
        this.isEdit = false
        this.appTitle = "新建入库单";
        // 入库单编号
        genEntityCode({ entityCode: "WAREHOUSE_OPERATE_IN", }).then((res) => {
          if (res.code == 200) {
            this.buildForm.taskCode = res.result;
          } else {
            this.buildForm.taskCode = "";
            this.$toast(res.message);
          }
        });
      }
    },
    // 入库物品明细-》添加
    addInventoryGoods() {
      this.appTitle = "选择物品";
      this.showGoodsPicker = true;
    },
    // 入库物品明细-》删除
    deleteGoods(i) {
      this.entryDetails.splice(i, 1);
    },
    // 确认选中物品 物品可复选
    getCheckedGoods(list) {
      this.showGoodsPicker = false;
      this.appTitle = this.isEdit ? "编辑入库单" : "新建入库单";
      let recTime = moment(new Date()).format("YYYY-MM-DD");
      let newbatchCode = recTime.replace(/\-/g, "").substring(2)

      let checkedGoods = list.map((son) => {
        let { id, goodsId, goodsCode, goodsName, spec, address, packageSpec, unitIdText, unitName, batchCode, goodsBatchId, produceDate, latticeList } = son
        return {
          id: id || '',
          goodsKey: (goodsId || id) + '_' + Math.floor(Math.random() * 1000),

          goodsId: (goodsId || id) || '',
          goodsCode: goodsCode || '-',
          goodsName: goodsName || '-',
          spec: spec || '-',

          packageSpec: packageSpec || '-',
          address: address || '-',
          unitName: (unitIdText || unitName) || '-',

          batchCode: batchCode || newbatchCode,
          goodsBatchId: goodsBatchId || '',
          produceDate: produceDate || recTime,

          inLatticeDtoList: latticeList || []
        };
      });

      this.entryDetails = this.entryDetails.concat(checkedGoods)

      this.entryDetails.forEach((ele) => {
        let { goodsId, batchCode } = ele

        if (ele.goodsBatchId == '') { // 批次id为空 获取批次信息
          getBathRelProductDate({ goodsId, batchCode }).then((res) => {
            if (res.code == 200 && res.result) {
              ele.goodsBatchId = res.result.id
            } else {
              ele.goodsBatchId = ''
            }
          })
        }

        if (ele.inLatticeDtoList.length == 0) { // 物品默认库位为空 查询默认库位
          queryDefaultLattice({ id: goodsId }).then((res) => {
            if (res.code == 200 && res.result) {
              let { defaultLatticeId, defaultLatticeCode, defaultLatticeName } = res.result
              ele.inLatticeDtoList = [
                {
                  latticeId: defaultLatticeId,
                  latticeInfo: defaultLatticeCode + '|' + defaultLatticeName,
                  goodsNum: ele.goodsNum || ''
                }
              ]
            } else {
              ele.inLatticeDtoList = []
            }
          })
        }
      })
    },
    // 打印
    btnPrint(id) {
      this.$router.push({
        path: "/warehouseWarrantPrintList",
        query: {
          id: id
        }
      });
    },

    /*收货数量 处理*/
    clearNoNum(value, maxValue) {
      //先把非数字的都替换掉，除了数字和.
      value = value.replace(/[^\d.]/g, "");
      //保证只有出现一个.而没有多个.
      value = value.replace(/\.{2,}/g, ".");
      //必须保证第一个为数字而不是.
      value = value.replace(/^\./g, "");
      //保证.只出现一次，而不能出现两次以上
      value = value
        .replace(".", "$#$")
        .replace(/\./g, "")
        .replace("$#$", ".");
      //只能输入四个小数
      value = value.replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, "$1$2.$3");
      // console.log(value.includes('.'),'wwwwww')
      //小数位处理
      if (value.substring(0, 1) == "0" && value.substring(0, 2) != "0.") {
        value = "0";
      }
      //输入长度控制
      if (value > 99999999999999.9999) {
        value = '';
      }

      return value;
    },
    // 打开选择时间
    openTimePicker(index, value, usedKey) {
      this.timeUsedKey = usedKey

      if (this.timeUsedKey != 'operateTime') {
        if (this.entryDetails[this.recentGoodsIndex].goodsBatchId) { // 当批次id存在时 生产日期选择禁用
          return
        }
        this.recentGoodsIndex = index
      }

      if (value) {
        this.happenTime = new Date(value)
      } else {
        this.happenTime = ''
      }
      this.timePickShow = true
    },
    // 确定选择时间
    confirmPick(date) {
      if (this.timeUsedKey != 'operateTime') {
        this.entryDetails[this.recentGoodsIndex][this.timeUsedKey] = moment(date).format("YYYY-MM-DD");
      } else {
        this.buildForm[this.timeUsedKey] = moment(date).format("YYYY-MM-DD");
      }

      this.timePickShow = false;
    },
    // 取消选择时间
    cancelPick() {
      this.timePickShow = false;
    },
    formatter(type, val) {
      if (type === "year") {
        return val + "年";
      }
      if (type === "month") {
        return val + "月";
      }
      if (type === "day") {
        return val + "日";
      }
      return val;
    },
    // 批号变更查询
    batchCodeChange(index, item) {
      this.recentGoodsIndex = index
      let { goodsId, batchCode } = item
      if (goodsId && batchCode) {
        getBathRelProductDate({ goodsId, batchCode }).then((res) => {
          if (res.code == 200 && res.result) {
            this.entryDetails[this.recentGoodsIndex].produceDate = res.result.produceDate
            this.entryDetails[this.recentGoodsIndex].goodsBatchId = res.result.id
          } else {
            this.entryDetails[this.recentGoodsIndex].produceDate = moment(new Date()).format("YYYY-MM-DD"),
              this.entryDetails[this.recentGoodsIndex].goodsBatchId = ''
          }
        })
      }
    },
    // 验证数组内是否存在相同对象
    hasDuplicateObjects(arr) {
      for (let i = 0; i < arr.length - 1; i++) {
        for (let j = i + 1; j < arr.length; j++) {
          if (this.isEqual(arr[i], arr[j]) > -1) {
            return this.isEqual(arr[i], arr[j]); // 存在重复对象
          }
        }
      }
      return -1; // 不存在重复对象
    },
    isEqual(obj1, obj2) {
      if (obj1['goodsId'] == obj2['goodsId']) {
        if (obj1['batchCode'] == obj2['batchCode']) {
          let recIndex = this.entryDetails.findIndex((ele) => ele.goodsId == obj1['goodsId'])
          return recIndex
        } else {
          return -1
        }
      } else {
        return -1
      }
    },
    // 扫码相关
    // 打开相机
    clickCode(index, cIndex, isshow) {
      let that = this;
      this.recentGoodsIndex = index
      this.recentLatIndex = cIndex
      this.isshow = isshow
      let platform = localStorage.getItem("currentEnvironment");
      switch (platform) {
        case "iwork":
          var opt = {
            success: function (res) {
              console.log(JSON.stringify(res), "APP扫码数据");
              if (res.retCode == 0) {
                that.onDecode(res.retData);
              } else {
                that.$toast(res.retMsg);
              }
            },
            fail: function (err) {
              that.$toast("扫码失败！");
            },
          };
          //插件调用代码
          WorkHelper.scan(opt);
          break;
        case "browser":
          // camera:: 'front'--前摄像头，'rear'后摄像头，'off'关闭摄像头，会获取最后一帧显示，'auto'开始获取摄像头
          that.codeForm.qrcode = true;
          that.camera = "rear";
          break;
        case "dingding":
          dd.biz.util.scan({
            type: "qrCode", // type 为 all、qrCode、barCode，默认是all。
            onSuccess: function (data) {
              //onSuccess将在扫码成功之后回调
              that.onDecode(data.text);
            },
            onFail: function (err) {
              // console.error(err,'error')
            },
          });
          break;
        default:
          "";
          break;
      }
    },
    // 扫码结果回调
    onDecode(result) {
      // result, 扫描结果，可以根据自己的需求来实现相应的功能
      this.codeForm.code = JSON.parse(result);
      if (this.codeForm.code.EntityType == "lattice" && this.codeForm.code.id) {
        // 库位二维码
        getWarehouseLatticeDetail(this.codeForm.code.id).then((res) => {
          if (res.code == 200 && res.result) {
            if (res.result.status == 'effective') {

              try {
                this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'].forEach((ele) => {
                  if (ele.latticeId == res.result.id) {
                    throw new Error(`该库位已存在`);
                  }
                })

                if (this.qrlatticeNotification.length != 0) {
                  this.qrlatticeNotification.forEach((ele) => {
                    if (ele.latticeId == res.result.id) {
                      throw new Error(`该库位已存在`);
                    }
                  })
                }

              } catch (error) {
                this.$toast(error.message);
                return false;
              }

              if (this.isshow) { // 批量扫码-库位
                let { id, latticeCode, latticeName } = res.result
                let recLength = this.qrlatticeNotification.length

                this.$set(this.qrlatticeNotification, recLength, {
                  latticeId: id,
                  latticeCode: latticeCode,
                  latticeName: latticeName,
                  latticeInfo: latticeCode + '|' + latticeName,
                  goodsNum: ''
                })
              } else { // 单个扫码-库位
                let { id, latticeCode, latticeName } = res.result
                this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'][this.recentLatIndex] = {
                  latticeId: id,
                  latticeCode: latticeCode,
                  latticeName: latticeName,
                  latticeInfo: latticeCode + '|' + latticeName,
                  goodsNum: ''
                }
                this.turnCameraOff()
              }
            } else {
              this.$toast("该库位已被禁用");
              // this.clickCode(this.recentGoodsIndex);
              this.clickCode(this.recentGoodsIndex, this.recentLatIndex, this.isshow);
            }
          } else {
            this.$toast(res.message);
          }
        })
      } else {
        this.$toast("请扫正确二维码");
        this.clickCode(this.recentGoodsIndex, this.recentLatIndex, this.isshow);
      }
    },
    // 相机反转
    switchCamera() {
      switch (this.camera) {
        case "front":
          this.camera = "rear";
          break;
        case "rear":
          this.camera = "front";
          break;
        default:
          this.$toast("错误");
      }
    },
    // 关闭相机
    turnCameraOff() {
      this.camera = "off";
      this.codeForm.qrcode = false;
      this.isshow = false
    },
    // 打开手电筒
    ClickFlash() {
      switch (this.torchActive) {
        case true:
          this.torchActive = false;
          break;
        case false:
          this.torchActive = true;
          break;
        default:
          this.$toast("错误");
      }
    },
    // 检查是否调用摄像头
    async onInit(promise) {
      try {
        await promise;
      } catch (error) {
        if (error.name === "StreamApiNotSupportedError") {
        } else if (error.name === "NotAllowedError") {
          this.errorMessage = "Hey! I need access to your camera";
        } else if (error.name === "NotFoundError") {
          this.errorMessage = "Do you even have a camera on your device?";
        } else if (error.name === "NotSupportedError") {
          this.errorMessage =
            "Seems like this page is served in non-secure context (HTTPS, localhost or file://)";
        } else if (error.name === "NotReadableError") {
          this.errorMessage =
            "Couldn't access your camera. Is it already in use?";
        } else if (error.name === "OverconstrainedError") {
          this.errorMessage =
            "Constraints don't match any installed camera. Did you asked for the front camera although there is none?";
        } else {
          this.errorMessage = "UNKNOWN ERROR: " + error.message;
        }
      }
    },
    // 激光扫码
    changeScan2(v) {
      console.log("扫码结果：", v);
      
      if (v.EntityType == "goods") {
        getWarehouseLatticeDetail(v.id).then((res) => {
          if (res.code == 200 && res.result) {
            if (res.result.status == 'effective') {
              let { id, latticeCode, latticeName } = res.result
              let recLatIndex = this.entryDetails[this.active]['inLatticeDtoList'].findIndex((ele) => ele.latticeId == id)
              if (recLatIndex == -1) {
                let obj = {
                  latticeId: id,
                  latticeCode: latticeCode,
                  latticeName: latticeName,
                  latticeInfo: latticeCode + '|' + latticeName,
                  goodsNum: ''
                }
                this.entryDetails[this.active]['inLatticeDtoList'].push(obj)
              } else {
                this.$toast("该库位已存在");
              }
            } else {
              this.$toast("该库位处于禁用状态");
            }
          } else {
            this.$toast("数据异常");
          }
        })
      } else if (v.EntityType == "lattice") {
        console.log("lattice", '库位码');
        console.log(this.isshow, 'this.isshow');
        console.log(this.entryDetails, 'this.entryDetails',this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList']);
        // 库位二维码
        getWarehouseLatticeDetail(v.id).then((res) => {
          if (res.code == 200 && res.result) {
            if (res.result.status == 'effective') {
              try {
                this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'].forEach((ele) => {
                  if (ele.latticeId == res.result.id) {
                    throw new Error(`该库位已存在`);
                  }
                })

                if (this.qrlatticeNotification.length != 0) {
                  this.qrlatticeNotification.forEach((ele) => {
                    if (ele.latticeId == res.result.id) {
                      throw new Error(`该库位已存在`);
                    }
                  })
                }

              } catch (error) {
                this.$toast(error.message);
                return false;
              }

              if (this.isshow) { // 批量扫码-库位
                let { id, latticeCode, latticeName } = res.result
                let recLength = this.qrlatticeNotification.length

                this.$set(this.qrlatticeNotification, recLength, {
                  latticeId: id,
                  latticeCode: latticeCode,
                  latticeName: latticeName,
                  latticeInfo: latticeCode + '|' + latticeName,
                  goodsNum: ''
                })
              } else { // 单个扫码-库位
                console.log('saoma',res.result);
                
                let { id, latticeCode, latticeName } = res.result
                this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'][this.recentLatIndex] = {
                  latticeId: id,
                  latticeCode: latticeCode,
                  latticeName: latticeName,
                  latticeInfo: latticeCode + '|' + latticeName,
                  goodsNum: ''
                }
              }
            } else {
              this.$toast("该库位已被禁用");
              // this.clickCode(this.recentGoodsIndex);
              this.clickCode(this.recentGoodsIndex, this.recentLatIndex, this.isshow);
            }
          } else {
            this.$toast(res.message);
          }
        })
      }
    },
    // 批量扫码弹窗 确定
    modelCofirm() {
      let recDtoList = this.entryDetails[this.recentGoodsIndex]['inLatticeDtoList'].concat(this.qrlatticeNotification)
      this.$set(this.entryDetails[this.recentGoodsIndex], 'inLatticeDtoList', recDtoList)

      this.isshow = false
      this.qrlatticeNotification = []
      this.turnCameraOff()
    },
    // 批量扫码弹窗 关闭
    modelClose() {
      this.qrlatticeNotification = []
      this.isshow = false
      this.turnCameraOff()
    },
    // 删除库位
    deleteLatticeInmodel(index) {
      this.qrlatticeNotification.splice(index, 1);
    },
  },
};
</script>
<style lang="scss" scoped>
@import "@/assets/theme.scss";
@import "@/views/workManagement/materialRequisition/materialForm.scss";

.tabs-contain {
  position: relative;

  /deep/.van-tabs__nav--line.van-tabs__nav--complete {
    width: calc(100% - 1.6rem);
  }

  /deep/.van-tabs__wrap--scrollable .van-tab {
    width: 33%;
    min-width: 230px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .all-down-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 90px;
    font-size: 28px;
    color: rgb(25, 137, 250);
    line-height: 90px;
    text-align: center;
    background-color: #fff;

    /deep/.van-icon {
      top: 6px;
    }
  }

  .all-down-model {
    position: absolute;
    top: 0;
    right: 0;
    width: 100vw;
    background-color: #fff;
    z-index: 9;
    border-bottom: 1px solid #f3f3f3;
    padding: 6px;

    .tags-contain {
      display: flex;
      flex-wrap: wrap;
      margin-bottom: 10px;

      .goodsNameTag {
        width: 22%;
        margin: 10px 10px;
        padding: 5px 20px;
        background-color: #f3f3f3;
        color: #333333;
        border-radius: 5px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        text-align: center;
        height: 60px;
        line-height: 42px;
      }
    }

    .ctrBtn-contian {
      height: 50px;
      text-align: center;
      color: #1890ff;
      font-size: 24px;
      line-height: 50px;

      /deep/.van-icon {
        top: 6px;
      }
    }
  }
}

.qrcodeModel {
  background-color: rgb(243, 243, 243);

  .nav_contain {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ceced1;
    padding: 24px 20px 10px;
    position: fixed;
    width: 100vw;
    z-index: 2006;
    background: #fff;

    span {
      font-size: 32px;
    }

    .left {
      color: #3ba1ff;
    }

    .center {
      color: #191f25;
      font-weight: bolder;
    }

    .right {
      color: #3ba1ff;
    }
  }

  .goodsInfo {
    position: relative;
    top: 90px;
    margin-top: 0;

    .wrap {
      background: #fff;
      width: 100vw;

      .otherText {
        display: flex;
        justify-content: space-between;
        font-size: 32px;
        color: #191f25;
        margin: 0;
        font-weight: 500;

        .deleteStyle {
          font-weight: 400;
          color: #ff4d4f
        }
      }

      .top {
        display: flex;
        justify-content: flex-start;
        padding-top: 10px;

        .icon {
          width: 6px;
          height: 32px;
          background: #1890ff;
          margin: 6px 10px 0 10px;
        }

        .title {
          width: 602px;
          margin-right: 20px;
          font-size: 30px;
          font-family: PingFang SC;
          font-weight: 400;
          color: #191f25;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .titleWidth {
          width: 600px;
          margin: 0 25px;
        }
      }

      .center {
        display: flex;
        justify-content: space-between;
        margin: 0 0 30px;

        p {
          margin: 0.2rem 0 0 0.34rem;
          font-size: 28px;
          display: flex;
          position: relative;

          .key {
            color: #888888;
            //width: 2rem;
          }

          .value {
            color: #191f25;
            width: 240px;
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }

          .arrow {
            color: #1890ff;
            position: absolute;
            right: -10px;
          }

          /deep/.van-tag {
            margin-right: 10px;
            width: 160px;
            flex-direction: column;
          }
        }

        .totalContain {
          // flex: 1;
          margin-right: 10px;

          p {
            font-size: 24px;
          }
        }
      }
    }
  }

  .list {
    margin-top: 102px;

    .wrap {
      background: #fff;
      width: 100vw;

      .otherText {
        display: flex;
        justify-content: space-between;
        font-size: 32px;
        color: #191f25;
        margin: 0;
        font-weight: 500;

        .deleteStyle {
          font-weight: 400;
          color: #ff4d4f
        }
      }

      .top {
        display: flex;
        justify-content: flex-start;
        padding-top: 10px;

        .icon {
          width: 6px;
          height: 32px;
          background: #1890ff;
          margin: 6px 10px 0 10px;
        }

        .title {
          width: 602px;
          margin-right: 20px;
          font-size: 30px;
          font-family: PingFang SC;
          font-weight: 400;
          color: #191f25;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .titleWidth {
          width: 600px;
          margin: 0 25px;
        }
      }

      .center {
        margin: 0 0 30px;

        p {
          margin: 6px 25px;
          font-size: 28px;
          display: flex;
          position: relative;

          .key {
            color: #888888;
          }

          .value {
            color: #191f25;
            width: 380px;
            display: block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }

          .arrow {
            color: #1890ff;
            position: absolute;
            right: -10px;
          }

          /deep/.van-tag {
            margin-right: 10px;
            width: 160px;
            flex-direction: column;
          }
        }
      }
    }
  }
}

.form-content {
  width: 100%;
  height: calc(100vh - 203px);
  background: #f5f5f5;
  overflow: scroll;
  padding: 20px 0;

  .formgroup {
    background: #ffffff;
    margin-top: 0.1rem;
    margin-bottom: 0.2rem;
    padding-top: 0.1rem;

    .title {
      width: 0.58rem;
      height: 0.14rem;
      font-size: 0.15rem;
      font-family: PingFang SC;
      font-weight: 400;
      color: #191f25;
      line-height: 0.05rem;
      margin-left: 0.16rem;
    }
  }

  .search-bottoms {
    width: 100%;
    height: 100px;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0px;
    padding: 0rem 11px;
    box-sizing: border-box;
    font-size: 32px;
    font-weight: 500;
    z-index: 9;

    .btnconfirm {
      flex: 1;
      background: #1890ff;
      box-sizing: border-box;
      height: 78px;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 6px;
      color: #ffffff;
    }

    .btncancle {
      width: 270px;
      margin: 0 30px;
      background: #f2f2f6;
      color: #1a2026;
      box-sizing: border-box;
      height: 78px;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 6px;
    }
  }
}

.bottomLine {
  height: 1px;
  background-color: #f2f2f2;
  margin: 0 2px;
}

.haveUnitBox {
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding-right: 32px;

  /deep/ .van-cell {
    padding-right: 0;
    width: 600px;
  }

  /deep/ .van-field__control {
    max-width: 700px;
  }
}

/deep/ .van-nav-bar {
  z-index: 99;
}

/deep/.van-sidebar-item--select::before {
  color: #1890ff;
  background-color: #1890ff;
}

/deep/.van-tree-select__item--active {
  color: #1890ff;
}

.addGoodScontain {
  display: flex;
  flex-wrap: nowrap;
  padding: 16px 0;

  .addgoods {
    flex: 1;
    background: #fff;
    font-size: 32px;
    text-align: center;
    height: 78px;
    line-height: 78px;
    color: #1890ff;
  }
}

.required span::after {
  left: -20px;
  top: 3px;
}

.filedClear {
  width: 28px;
  height: 28px;
}

.formItemFlex {
  display: flex;
  flex-direction: row;

  .FormTit {
    flex: 1;
    min-width: 3.3rem;
    padding-top: 0.33rem;
  }

  .haveUnitBox {
    flex: 1;

    .van-cell {
      width: 6.2rem;
    }
  }
}

.list {
  margin-top: 10px;

  .wrap {
    background: #fff;
    width: 100vw;

    .otherText {
      display: flex;
      justify-content: space-between;
      font-size: 32px;
      font-weight: bold;
      color: #191f25;

      .deleteStyle {
        font-weight: 400;
        color: #ff4d4f
      }
    }

    .top {
      display: flex;
      justify-content: flex-start;
      padding-top: 10px;

      .icon {
        width: 6px;
        height: 32px;
        background: #1890ff;
        margin: 6px 10px 0 10px;
      }

      .title {
        width: 602px;
        margin-right: 20px;
        font-size: 30px;
        font-family: PingFang SC;
        font-weight: 400;
        color: #191f25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .titleWidth {
        width: 600px;
        margin: 16px 25px;
      }
    }

    .center {
      p {
        margin: 16px 25px;
        font-size: 28px;
        display: flex;
        position: relative;

        .key {
          color: #888888;
        }

        .value {
          color: #191f25;
          width: 380px;
          display: block;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        .arrow {
          color: #1890ff;
          position: absolute;
          right: -10px;
        }
      }

      .showAll {
        background: #f5f8ff;
        width: 100vw;
        margin-left: -30px;
        padding: 30px;
        margin-bottom: 30px;
      }

      .showAll2 {
        width: 100%;
        margin: 0 0 30px 0;
        padding: 30px 0;
      }
    }

  }
}
</style>
